<template>
  <div class="qa-card">
    <div class="qa-header">
      <div class="avatar">
        <i v-if="!question.avatar" class="bi bi-person"></i>
        <img v-if="question.avatar" :src="question.avatar" class="img-fluid rounded" alt="">
      </div>
      <div>
        <div>{{ question.username }}</div>
        <div class="qa-meta">
          <span class="qa-subject">{{ question.subject }}</span>
          <span>{{ question.time }}</span>
        </div>
      </div>
    </div>
    <div class="qa-content">
      <router-link 
        :to="`/qa-detail-t/${question.id}/${question.subjectId}`"
        class="text-dark text-decoration-none"
      >
        {{ question.content }}
      </router-link>
<!--      <div v-if="question.image" class="qa-image">-->
<!--        <img :src="question.image" :alt="question.content" class="img-fluid rounded">-->
<!--      </div>-->
    </div>
    <div class="qa-footer">
      <div class="qa-actions">
        <a href="#" class="qa-action">
          <i class="bi bi-chat"></i>
          <span>{{ question.answers }}条回答</span>
        </a>
        <a href="#" class="qa-action">
          <i class="bi bi-hand-thumbs-up"></i>
          <span>{{ question.likes }}</span>
        </a>
      </div>
<!--      <a href="#" class="qa-action">-->
<!--        <i class="bi bi-share"></i>-->
<!--        <span>分享</span>-->
<!--      </a>-->
    </div>
  </div>
</template>

<script>
export default {
  name: 'QaCardT',
  props: {
    question: {
      type: Object,
      required: true
    }
  },
  mounted() {
  }
}

</script>

<style scoped>
.qa-card {
  background: white;
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 15px;
}
.qa-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #eee;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
}
.qa-meta {
  color: #666;
  font-size: 0.9rem;
}
.qa-subject {
  display: inline-block;
  padding: 2px 8px;
  background: #f0f9f9;
  border-radius: 12px;
  font-size: 0.8rem;
  color: #00b8a9;
  margin-right: 8px;
}
.qa-content {
  margin: 10px 0;
  line-height: 1.6;
}
.qa-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #666;
  font-size: 0.9rem;
}
.qa-actions {
  display: flex;
  gap: 15px;
}
.qa-action {
  color: #666;
  text-decoration: none;
}
.qa-image {
  margin: 10px 0;
}
.qa-image img {
  max-width: 100%;
  border-radius: 8px;
}
</style> 